[AAASM-3020] ♻️ (types): Adopt PEP 695 typing standard#131
Conversation
PEP 695 (the `type` statement + type-parameter syntax) is supported from mypy 1.11; bump the floor so the typing standard is enforced. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The module docstring already states aliases use the PEP 695 `type` statement, but the code used legacy assignment. Convert it so the code matches the documented standard. Annotation-only; no behaviour change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a Type annotations (PEP 695) section: prefer the `type` alias statement and `class C[T]`/`def f[T]` generics, requiring mypy >= 1.11. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🤖 Claude Code — PR reviewTicket: AAASM-3020 — Adopt PEP 695 as the python-sdk typing standard. CI — ✅ all green
Scope vs. acceptance criteria — ✅ complete
4 granular commits (floor bump · Dependency note (non-blocking, merge order irrelevant)Conflict-free with the open #130 (AAASM-3017). Only shared file is ReadinessReady to merge pending one Pioneer-team approval. CI fully green, behaviour-neutral, all ACs met. Establishes the PEP 695 standard the codebase already documented but hadn't applied. Recorded as a review note; no formal approval submitted. |



Summary
Adopts PEP 695 as the python-sdk typing standard (Python ≥ 3.12). Implements AAASM-3020.
pyproject.toml— bump the mypy floor>=1.2.0→>=1.11(PEP 695 support landed in mypy 1.11; installed toolchain is already 1.17).agent_assembly/types.py— convertCallStackNodeKind = Literal[...]to the PEP 695typestatement (type CallStackNodeKind = Literal[...]). The module docstring already claimed aliases use thetypestatement — the code now matches it. Annotation-only, lazily evaluated; no runtime/behaviour change.CONTRIBUTING.md— new "Type annotations (PEP 695)" section: prefertype X = …aliases andclass C[T]/def f[T]generics.There are 0 existing
TypeVar/Genericusages, so this is forward-convention + the type-alias win — no generic retrofit.Type of Change
Breaking Changes
CallStackNodeKindstays aLiteralalias, public API unchanged)Testing
mypy agent_assembly/types.py→ Success: no issues found (the converted file is type-clean).Dependency note (read before merge)
This PR is conflict-free with the open PR #130 (AAASM-3017, mypy debt) — the only shared file is
types.py, and the edits are on non-overlapping lines (this PR: line 24; #130: line 110), so git auto-merges regardless of order.A full repo-wide
mypy agent_assemblycurrently reports 34 errors — all pre-existing in other files (emitter.py,__init__.py,models/agent.py), which #130 fixes. This PR adds 0 new mypy errors (verified: 34 baseline → 34;types.pyitself is clean). Once #130 merges, the repo-wide mypy goes to 0. Merge order between this and #130 does not matter.Closes AAASM-3020.